package cn.funeralobjects.util.model;

import lombok.Getter;
import lombok.ToString;
import lombok.experimental.Accessors;

/**
 * 当前系统信息
 *
 * @author FuneralObjects
 * Create date: 2020/4/14 11:25 AM
 */
@Getter
@Accessors(chain = true)
@ToString
public class SystemInfo {
    /**
     * 使用的Java版本
     */
    private String javaVersion;
    /**
     * 使用的Java所在的路径
     */
    private String javaHome;
    /**
     * 系统名称
     */
    private String osName;
    /**
     * 系统版本
     */
    private String osVersion;
    /**
     * 文件编码
     */
    private String fileEncoding;
    /**
     * 行分隔符
     */
    private String lineSeparator;
    /**
     * 路径分隔符
     */
    private String pathSeparator;
    /**
     * 文件分隔符
     */
    private String fileSeparator;
    /**
     * 系统Unicode的IO流编码
     */
    private String ioUnicodeEncoding;
    /**
     * 系统默认编码
     */
    private String encoding;
    /**
     * 当前用户目录
     */
    private String userHome;
    /**
     * 当前用户所在国家
     */
    private String userCountry;
    /**
     * 系统架构
     */
    private String osArch;

    public SystemInfo cloneNew() {
        try {
            return (SystemInfo) this.clone();
        } catch (CloneNotSupportedException e) {
            throw new RuntimeException(e);
        }
    }

    public SystemInfo(String javaVersion,
                      String javaHome,
                      String osName,
                      String osVersion,
                      String fileEncoding,
                      String lineSeparator,
                      String pathSeparator,
                      String fileSeparator,
                      String ioUnicodeEncoding,
                      String encoding,
                      String userHome,
                      String userCountry,
                      String osArch) {
        this.javaVersion = javaVersion;
        this.javaHome = javaHome;
        this.osName = osName;
        this.osVersion = osVersion;
        this.fileEncoding = fileEncoding;
        this.lineSeparator = lineSeparator;
        this.pathSeparator = pathSeparator;
        this.fileSeparator = fileSeparator;
        this.ioUnicodeEncoding = ioUnicodeEncoding;
        this.encoding = encoding;
        this.userHome = userHome;
        this.userCountry = userCountry;
        this.osArch = osArch;
    }
}
